var express = require('express');
var router = express.Router();
var indexController = require("../controllers/index_controller")
/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', {
    title: 'Express'
  });
});
// 添加学生综测分

router.post("/AddStudentScore", (req, res) => {
  var {
    SecondaryCollege,
    student_Number,
    school_year,
    grade,
    className,
    semester,
    dataList,
  } = req.body
  // console.log(SecondaryCollege,
  //   student_Number,
  //   school_year,
  //   grade,
  //   className,
  //   semester,
  //   dataList);
    
  // var dataList = {
  //   "SecondaryCollege": "美术与设计学院",
  //   "Secondarystudent": [{
  //     "className": "美术18班",
  //     "studentList": [{
  //       "student_Number": "201805403130",
  //       "studentName": "张三",
  //       "schoolYearList": [{
  //         "schoolYear": "2020-2021",
  //         "grade":"大三",
  //         "score_item": [{
  //           "semester": "二",
  //           "ScoreDetails": [{
  //             "numberNo": 1,
  //             "jia": "宿舍4次满分",
  //             "jian": "",
  //             "DE": "1",
  //             "ZHI": 0,
  //             "TI": 0,
  //             "show": true
  //           }],
  //           "scoreList": {
  //             "moralEducation": {
  //               "DeBasicScore": 70,
  //               "moralEducationScore": 1,
  //               "TotalScore": "21.30"
  //             },
  //             "IntellectualEducation": {
  //               "ZhiBasicScore": "85",
  //               "IntellectualEducationScore": 0,
  //               "TotalScore": "42.50"
  //             },
  //             "Sports": {
  //               "TiBasicScore": 70,
  //               "SportsScore": 0,
  //               "TotalScore": "14.00"
  //             },
  //             "ComprehensiveSurveyTotalScore": "77.80",
  //             "ComprehensiveSurveyRanking": "无用",
  //             "monitor": "梁瑞珍",
  //             "headmaster": "何家莉",
  //             "instructor": "陈罗庚"
  //           }
  //         }]
  //       }]
  //     }]
  //   }]
  // }
  indexController.addStudentScorelist({
    SecondaryCollege,
    student_Number,
    dataList,
    school_year,
    grade,
    className,
    semester
  }, ["添加综测失败", "添加综测成功"], (result) => {
    res.json(result)
  })
})
module.exports = router;